﻿<ResourceDictionary
	xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
	xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
	xmlns:GraphSharp_Controls="clr-namespace:GraphSharp.Controls" 
	xmlns:Converters="clr-namespace:GraphSharp.Converters"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:settings="clr-namespace:XmlStudio.Settings"
    xmlns:c="clr-namespace:XmlStudio.Controls"
    mc:Ignorable="d">
    <ResourceDictionary.MergedDictionaries>
    </ResourceDictionary.MergedDictionaries>

    <Converters:EdgeRouteToPathConverter x:Key="routeToPathConverter" />

    <SolidColorBrush x:Key="VertexDefaultFillBrush" Color="#FFE3E3E3" />
    <SolidColorBrush x:Key="VertexDefaultStrokeBrush" Color="Black" />
    <SolidColorBrush x:Key="HighlightedVertexBorderBrush" Color="Transparent" />
    <SolidColorBrush x:Key="HighlightedVertexBackgroundBrush" Color="{DynamicResource {x:Static SystemColors.HighlightColorKey}}" />
    <SolidColorBrush x:Key="HighlightedVertexForegroundBrush" Color="{DynamicResource {x:Static SystemColors.ControlLightLightColorKey}}" />
    <SolidColorBrush x:Key="SemiHighlightedSourceVertexBorderBrush" Color="Transparent" />
    <SolidColorBrush x:Key="SemiHighlightedSourceVertexBackgroundBrush" Color="#FF1DBA00" />
    <SolidColorBrush x:Key="SemiHighlightedTargetVertexBorderBrush" Color="Transparent" />
    <SolidColorBrush x:Key="SemiHighlightedTargetVertexBackgroundBrush" Color="#FFD6A51C" />
    <SolidColorBrush x:Key="HighlightedEdgeBrush" Color="{DynamicResource {x:Static SystemColors.HighlightColorKey}}" />
    <SolidColorBrush x:Key="SemiHighlightedInEdgeBrush" Color="#FF1DBA00" />
    <SolidColorBrush x:Key="SemiHighlightedOutEdgeBrush" Color="#FFD6A51C" />
    <SolidColorBrush x:Key="SelectedVertexBackgroundBrush" Color="#FFC7D7FF" />

    <Style x:Key="FlowChartItemStyle" TargetType="Path">
        <Setter Property="Fill" Value="{Binding RelativeSource={RelativeSource x:AncestorType=GraphSharp_Controls:VertexControl}, Path=Background, FallbackValue={StaticResource VertexDefaultFillBrush}}"/>
        <Setter Property="Stroke" Value="{Binding RelativeSource={RelativeSource x:AncestorType=GraphSharp_Controls:VertexControl}, Path=BorderBrush, FallbackValue={StaticResource VertexDefaultStrokeBrush}}"/>
        <Setter Property="StrokeThickness" Value="1"/>
        <Setter Property="StrokeLineJoin" Value="Round"/>
        <Setter Property="Stretch" Value="Fill"/>
        <Setter Property="IsHitTestVisible" Value="False"/>
        <Setter Property="SnapsToDevicePixels" Value="True"/>
        <Setter Property="BitmapEffect">
            <Setter.Value>
                <DropShadowBitmapEffect Color="#AAA" Direction="315" ShadowDepth="10" Softness="0.5" Opacity="0.6"/>
            </Setter.Value>
        </Setter>
    </Style>

    <!-- Process -->
    <Style x:Key="Process" TargetType="Path" BasedOn="{StaticResource FlowChartItemStyle}">
        <Setter Property="Data" Value="M 0,0 H 60 V40 H 0 Z"/>
    </Style>

    <!-- Process  appearance -->
    <ControlTemplate x:Key="AppearanceProcess">
        <Grid IsHitTestVisible="False">
            <Path IsHitTestVisible="False" Style="{StaticResource Process}" />
        </Grid>
    </ControlTemplate>

    <!-- Decision -->
    <Style x:Key="Decision" TargetType="Path" BasedOn="{StaticResource FlowChartItemStyle}">
        <Setter Property="Data" Value="M 0,20 L 30 0 L 60,20 L 30,40 Z"/>
    </Style>

    <ControlTemplate x:Key="AppearanceDecision">
        <Grid>
            <Path Style="{StaticResource Decision}" />
        </Grid>
    </ControlTemplate>

    <!-- Terminator -->
    <Style x:Key="Terminator" TargetType="Path" BasedOn="{StaticResource FlowChartItemStyle}">
        <Setter Property="Data" Value="M 20,40 A 20,20 0 0 1 20,0 H 40 A 20,20 0 0 1 40,40 Z"/>
    </Style>

    <!-- Terminator appearance -->
    <ControlTemplate x:Key="AppearanceTerminator">
        <Grid>
            <Path Style="{StaticResource Terminator}" />
        </Grid>
    </ControlTemplate>

    <!-- Document -->
    <Style x:Key="Document" TargetType="Path" BasedOn="{StaticResource FlowChartItemStyle}">
        <Setter Property="Data" Value="M 0,0 H 60 V 40 C 30,30 30,50 0,40 Z"/>
    </Style>

    <!-- Document appearance -->
    <ControlTemplate x:Key="AppearanceDocument">
        <Grid>
            <Path Style="{StaticResource Document}" />
        </Grid>
    </ControlTemplate>

    <!-- Data -->
    <Style x:Key="Data" TargetType="Path" BasedOn="{StaticResource FlowChartItemStyle}">
        <Setter Property="Data" Value="M 10,0 L 60 0 L 50,40 L 0,40 Z"/>
    </Style>

    <!-- Data appearance -->
    <ControlTemplate x:Key="AppearanceData">
        <Grid>
            <Path Style="{StaticResource Data}" />
        </Grid>
    </ControlTemplate>

    <!-- Start -->
    <Style x:Key="Start" TargetType="Path" BasedOn="{StaticResource FlowChartItemStyle}">
        <Setter Property="Data" Value="M 10,20 A 20,20 0 1 1 50,20 A 20,20 0 1 1 10,20"/>
    </Style>

    <!-- Start appearance -->
    <ControlTemplate x:Key="AppearanceStart">
        <Grid>
            <Path Style="{StaticResource Start}" />
        </Grid>
    </ControlTemplate>

    <!-- Predefined -->
    <Style x:Key="Predefined" TargetType="Path" BasedOn="{StaticResource FlowChartItemStyle}">
        <Setter Property="Data" Value="M 50,0 V 40 M 10,0 V 40 M 0 0 H 60 V 40 H 0 Z"/>
    </Style>

    <!-- Predefined appearance -->
    <ControlTemplate x:Key="AppearancePredefined">
        <Grid>
            <Path Style="{StaticResource Predefined}" />
        </Grid>
    </ControlTemplate>

    <!-- StoredData -->
    <Style x:Key="StoredData" TargetType="Path" BasedOn="{StaticResource FlowChartItemStyle}">
        <Setter Property="Data" Value="M 5,0 H 60 A 40,40 0 0 0 60,40 H 5 A 40,40 0 0 1 5,0 Z"/>
    </Style>

    <!-- StoredData appearance -->
    <ControlTemplate x:Key="AppearanceStoredData">
        <Grid>
            <Path Style="{StaticResource StoredData}" />
        </Grid>
    </ControlTemplate>

    <!-- InternalStorage -->
    <Style x:Key="InternalStorage" TargetType="Path" BasedOn="{StaticResource FlowChartItemStyle}">
        <Setter Property="Data" Value="M 0,10 H 60 M 10,0 V 40 M 0,0 H 60 V 40 H 0 Z"/>
    </Style>

    <!-- InternalStorage appearance -->
    <ControlTemplate x:Key="AppearanceInternalStorage">
        <Grid>
            <Path Style="{StaticResource InternalStorage}" />
        </Grid>
    </ControlTemplate>

    <!-- SequentialData -->
    <Style x:Key="SequentialData" TargetType="Path" BasedOn="{StaticResource FlowChartItemStyle}">
        <Setter Property="Data" Value="M 30,40 A 20,20 0 1 1 30,0 A 20,20 0 0 1 43,35 H 50 L 50,40 Z"/>
    </Style>

    <!-- SequentialData appearance -->
    <ControlTemplate x:Key="AppearanceSequentialData">
        <Grid>
            <Path Style="{StaticResource SequentialData}" />
        </Grid>
    </ControlTemplate>

    <!-- DirectData -->
    <Style x:Key="DirectData" TargetType="Path" BasedOn="{StaticResource FlowChartItemStyle}">
        <Setter Property="Data" Value="F 1 M 57,40 H 3 A 4,20 0 1 1 3,0 H 57 A 4,20.1 0 1 1 56,0"/>
    </Style>

    <!-- DirectData appearance -->
    <ControlTemplate x:Key="AppearanceDirectData">
        <Grid>
            <Path Style="{StaticResource DirectData}" />
        </Grid>
    </ControlTemplate>

    <!-- ManualInput -->
    <Style x:Key="ManualInput" TargetType="Path" BasedOn="{StaticResource FlowChartItemStyle}">
        <Setter Property="Data" Value="M 0 10 L 60,0 V 40 H 0 Z"/>
    </Style>

    <!-- ManualInput appearance -->
    <ControlTemplate x:Key="AppearanceManualInput">
        <Grid>
            <Path Style="{StaticResource ManualInput}" />
        </Grid>
    </ControlTemplate>

    <!-- Card -->
    <Style x:Key="Card" TargetType="Path" BasedOn="{StaticResource FlowChartItemStyle}">
        <Setter Property="Data" Value="M 0 10 L 10,0 H 60 V 40 H 0 Z"/>
    </Style>

    <!-- Card appearance -->
    <ControlTemplate x:Key="AppearanceCard">
        <Grid>
            <Path Style="{StaticResource Card}" />
        </Grid>
    </ControlTemplate>

    <!-- PaperTape -->
    <Style x:Key="PaperTape" TargetType="Path" BasedOn="{StaticResource FlowChartItemStyle}">
        <Setter Property="Data" Value="M 0,3 C 30,-7 30,13 60,3 V 37 C 30,47 30,27 0,37 Z"/>
    </Style>

    <!-- PaperTape appearance -->
    <ControlTemplate x:Key="AppearancePaperTape">
        <Grid>
            <Path Style="{StaticResource PaperTape}" />
        </Grid>
    </ControlTemplate>

    <!-- Delay -->
    <Style x:Key="Delay" TargetType="Path" BasedOn="{StaticResource FlowChartItemStyle}">
        <Setter Property="Data" Value="M 0,0 H 40 A 20,20 0 0 1 40,40 H 0 Z"/>
    </Style>

    <!-- Delay appearance -->
    <ControlTemplate x:Key="AppearanceDelay">
        <Grid>
            <Path Style="{StaticResource Delay}" />
        </Grid>
    </ControlTemplate>

    <!-- Display -->
    <Style x:Key="Display" TargetType="Path" BasedOn="{StaticResource FlowChartItemStyle}">
        <Setter Property="Data" Value="M 0,20 A 40,40 0 0 1 15,0 H 55 A 60,60 0 0 1 55,40 H 15 A 40,40, 0 0 1 0,20 Z"/>
    </Style>

    <!-- Display appearance -->
    <ControlTemplate x:Key="AppearanceDisplay">
        <Grid>
            <Path Style="{StaticResource Display}" />
        </Grid>
    </ControlTemplate>

    <!-- LoopLimit -->
    <Style x:Key="LoopLimit" TargetType="Path" BasedOn="{StaticResource FlowChartItemStyle}">
        <Setter Property="Data" Value="M 0 10 L 10,0 H 50 L 60,10 V 40 H 0 Z"/>
    </Style>

    <!-- LoopLimit appearance -->
    <ControlTemplate x:Key="AppearanceLoopLimit">
        <Grid>
            <Path Style="{StaticResource LoopLimit}" />
        </Grid>
    </ControlTemplate>

    <!-- Preparation -->
    <Style x:Key="Preparation" TargetType="Path" BasedOn="{StaticResource FlowChartItemStyle}">
        <Setter Property="Data" Value="M 0,20 L 10,0  H 50 L 60,20 L 50,40 H10 Z"/>
    </Style>

    <!-- Preparation appearance -->
    <ControlTemplate x:Key="AppearancePreparation">
        <Grid>
            <Path Style="{StaticResource Preparation}" />
        </Grid>
    </ControlTemplate>

    <!-- ManualOperation -->
    <Style x:Key="ManualOperation" TargetType="Path" BasedOn="{StaticResource FlowChartItemStyle}">
        <Setter Property="Data" Value="M 0 0 H 60 L 50 40 H 10 Z"/>
    </Style>

    <!-- ManualOperation appearance -->
    <ControlTemplate x:Key="AppearanceManualOperation">
        <Grid>
            <Path Style="{StaticResource ManualOperation}" />
        </Grid>
    </ControlTemplate>

    <!-- OffPageReference -->
    <Style x:Key="OffPageReference" TargetType="Path" BasedOn="{StaticResource FlowChartItemStyle}">
        <Setter Property="Data" Value="M 0 0 H 60 V 20 L 30,40 L 0,20 Z"/>
    </Style>

    <!-- OffPageReference appearance -->
    <ControlTemplate x:Key="AppearanceOffPageReference">
        <Grid>
            <Path Style="{StaticResource OffPageReference}" />
        </Grid>
    </ControlTemplate>

    <!-- List of all appearances -->
    <ComboBox x:Key="cb_Appearances" SelectedIndex="0" x:Shared="False">
        <ComboBoxItem ToolTip="Process" Tag="AppearanceProcess" Margin="5">
            <Path Style="{StaticResource Process}" ToolTip="Process" Fill="{Binding Source={x:Static settings:XmlStudioSettings.Instance}, Path=VertexDefaultFillBrush}"
                  Stroke="{Binding Source={x:Static settings:XmlStudioSettings.Instance}, Path=VertexDefaultStrokeBrush}">
            </Path>
        </ComboBoxItem>
        <ComboBoxItem Tag="AppearanceTerminator" ToolTip="Terminator" Margin="5">
            <Path Style="{StaticResource Terminator}" ToolTip="Terminator" Fill="{Binding Source={x:Static settings:XmlStudioSettings.Instance}, Path=VertexDefaultFillBrush}"
                  Stroke="{Binding Source={x:Static settings:XmlStudioSettings.Instance}, Path=VertexDefaultStrokeBrush}">
            </Path>
        </ComboBoxItem>
        <ComboBoxItem Tag="AppearanceDecision" ToolTip="Decision" Margin="5">
            <Path Style="{StaticResource Decision}" ToolTip="Decision" Fill="{Binding Source={x:Static settings:XmlStudioSettings.Instance}, Path=VertexDefaultFillBrush}"
                  Stroke="{Binding Source={x:Static settings:XmlStudioSettings.Instance}, Path=VertexDefaultStrokeBrush}">
            </Path>
        </ComboBoxItem>
        <ComboBoxItem Tag="AppearanceDocument" ToolTip="Document" Margin="5">
            <Path Style="{StaticResource Document}" ToolTip="Document" Fill="{Binding Source={x:Static settings:XmlStudioSettings.Instance}, Path=VertexDefaultFillBrush}"
                  Stroke="{Binding Source={x:Static settings:XmlStudioSettings.Instance}, Path=VertexDefaultStrokeBrush}">
            </Path>
        </ComboBoxItem>
        <ComboBoxItem Tag="AppearanceData" ToolTip="Data" Margin="5">
            <Path Style="{StaticResource Data}" ToolTip="Data" Fill="{Binding Source={x:Static settings:XmlStudioSettings.Instance}, Path=VertexDefaultFillBrush}"
                  Stroke="{Binding Source={x:Static settings:XmlStudioSettings.Instance}, Path=VertexDefaultStrokeBrush}">
            </Path>
        </ComboBoxItem>
        <ComboBoxItem Tag="AppearanceStart" ToolTip="Start" Margin="5">
            <Path Style="{StaticResource Start}" ToolTip="Start" Fill="{Binding Source={x:Static settings:XmlStudioSettings.Instance}, Path=VertexDefaultFillBrush}"
                  Stroke="{Binding Source={x:Static settings:XmlStudioSettings.Instance}, Path=VertexDefaultStrokeBrush}">
            </Path>
        </ComboBoxItem>
        <ComboBoxItem Tag="AppearancePredefined" ToolTip="Predefined" Margin="5">
            <Path Style="{StaticResource Predefined}" ToolTip="Predefined" Fill="{Binding Source={x:Static settings:XmlStudioSettings.Instance}, Path=VertexDefaultFillBrush}"
                  Stroke="{Binding Source={x:Static settings:XmlStudioSettings.Instance}, Path=VertexDefaultStrokeBrush}">
            </Path>
        </ComboBoxItem>
        <ComboBoxItem Tag="AppearanceStoredData" ToolTip="StoredData" Margin="5">
            <Path Style="{StaticResource StoredData}" ToolTip="StoredData" Fill="{Binding Source={x:Static settings:XmlStudioSettings.Instance}, Path=VertexDefaultFillBrush}"
                  Stroke="{Binding Source={x:Static settings:XmlStudioSettings.Instance}, Path=VertexDefaultStrokeBrush}">
            </Path>
        </ComboBoxItem>
        <ComboBoxItem Tag="AppearanceInternalStorage" ToolTip="InternalStorage" Margin="5">
            <Path Style="{StaticResource InternalStorage}" ToolTip="InternalStorage" Fill="{Binding Source={x:Static settings:XmlStudioSettings.Instance}, Path=VertexDefaultFillBrush}"
                  Stroke="{Binding Source={x:Static settings:XmlStudioSettings.Instance}, Path=VertexDefaultStrokeBrush}">
            </Path>
        </ComboBoxItem>
        <ComboBoxItem Tag="AppearanceSequentialData" ToolTip="SequentialData" Margin="5">
            <Path Style="{StaticResource SequentialData}" ToolTip="SequentialData" Fill="{Binding Source={x:Static settings:XmlStudioSettings.Instance}, Path=VertexDefaultFillBrush}"
                  Stroke="{Binding Source={x:Static settings:XmlStudioSettings.Instance}, Path=VertexDefaultStrokeBrush}">
            </Path>
        </ComboBoxItem>
        <ComboBoxItem Tag="AppearanceDirectData" ToolTip="DirectData" Margin="5">
            <Path Style="{StaticResource DirectData}" ToolTip="DirectData" Fill="{Binding Source={x:Static settings:XmlStudioSettings.Instance}, Path=VertexDefaultFillBrush}"
                  Stroke="{Binding Source={x:Static settings:XmlStudioSettings.Instance}, Path=VertexDefaultStrokeBrush}">
            </Path>
        </ComboBoxItem>
        <ComboBoxItem Tag="AppearanceManualInput" ToolTip="ManualInput" Margin="5">
            <Path Style="{StaticResource ManualInput}" ToolTip="ManualInput" Fill="{Binding Source={x:Static settings:XmlStudioSettings.Instance}, Path=VertexDefaultFillBrush}"
                  Stroke="{Binding Source={x:Static settings:XmlStudioSettings.Instance}, Path=VertexDefaultStrokeBrush}">
            </Path>
        </ComboBoxItem>
        <ComboBoxItem Tag="AppearanceCard" ToolTip="Card" Margin="5">
            <Path Style="{StaticResource Card}" ToolTip="Card" Fill="{Binding Source={x:Static settings:XmlStudioSettings.Instance}, Path=VertexDefaultFillBrush}"
                  Stroke="{Binding Source={x:Static settings:XmlStudioSettings.Instance}, Path=VertexDefaultStrokeBrush}">
            </Path>
        </ComboBoxItem>
        <ComboBoxItem Tag="AppearancePaperTape" ToolTip="PaperTape" Margin="5">
            <Path Style="{StaticResource PaperTape}" ToolTip="PaperTape" Fill="{Binding Source={x:Static settings:XmlStudioSettings.Instance}, Path=VertexDefaultFillBrush}"
                  Stroke="{Binding Source={x:Static settings:XmlStudioSettings.Instance}, Path=VertexDefaultStrokeBrush}">
            </Path>
        </ComboBoxItem>
        <ComboBoxItem Tag="AppearanceDelay" ToolTip="Delay" Margin="5">
            <Path Style="{StaticResource Delay}" ToolTip="Delay" Fill="{Binding Source={x:Static settings:XmlStudioSettings.Instance}, Path=VertexDefaultFillBrush}"
                  Stroke="{Binding Source={x:Static settings:XmlStudioSettings.Instance}, Path=VertexDefaultStrokeBrush}">
            </Path>
        </ComboBoxItem>
        <ComboBoxItem Tag="AppearanceDisplay" ToolTip="Display" Margin="5">
            <Path Style="{StaticResource Display}" ToolTip="Display" Fill="{Binding Source={x:Static settings:XmlStudioSettings.Instance}, Path=VertexDefaultFillBrush}"
                  Stroke="{Binding Source={x:Static settings:XmlStudioSettings.Instance}, Path=VertexDefaultStrokeBrush}">
            </Path>
        </ComboBoxItem>
        <ComboBoxItem Tag="AppearanceLoopLimit" ToolTip="LoopLimit" Margin="5">
            <Path Style="{StaticResource LoopLimit}" ToolTip="LoopLimit" Fill="{Binding Source={x:Static settings:XmlStudioSettings.Instance}, Path=VertexDefaultFillBrush}"
                  Stroke="{Binding Source={x:Static settings:XmlStudioSettings.Instance}, Path=VertexDefaultStrokeBrush}">
            </Path>
        </ComboBoxItem>
        <ComboBoxItem Tag="AppearancePreparation" ToolTip="Preparation" Margin="5">
            <Path Style="{StaticResource Preparation}" ToolTip="Preparation" Fill="{Binding Source={x:Static settings:XmlStudioSettings.Instance}, Path=VertexDefaultFillBrush}"
                  Stroke="{Binding Source={x:Static settings:XmlStudioSettings.Instance}, Path=VertexDefaultStrokeBrush}">
            </Path>
        </ComboBoxItem>
        <ComboBoxItem Tag="AppearanceManualOperation" ToolTip="ManualOperation" Margin="5">
            <Path Style="{StaticResource ManualOperation}" ToolTip="ManualOperation" Fill="{Binding Source={x:Static settings:XmlStudioSettings.Instance}, Path=VertexDefaultFillBrush}"
                  Stroke="{Binding Source={x:Static settings:XmlStudioSettings.Instance}, Path=VertexDefaultStrokeBrush}">
            </Path>
        </ComboBoxItem>
        <ComboBoxItem Tag="AppearanceOffPageReference" ToolTip="OffPageReference" Margin="5">
            <Path Style="{StaticResource OffPageReference}" ToolTip="OffPageReference" Fill="{Binding Source={x:Static settings:XmlStudioSettings.Instance}, Path=VertexDefaultFillBrush}"
                  Stroke="{Binding Source={x:Static settings:XmlStudioSettings.Instance}, Path=VertexDefaultStrokeBrush}">
            </Path>
        </ComboBoxItem>
    </ComboBox>

    <!-- ResizeDecorator Default Template -->
    <ControlTemplate x:Key="ResizeDecoratorTemplate" TargetType="{x:Type Control}">
        <Grid Opacity="0.7" SnapsToDevicePixels="true">
            <c:ResizeThumb Height="3" Cursor="SizeNS" Margin="0 -4 0 0"
                     VerticalAlignment="Top" HorizontalAlignment="Stretch"/>
            <c:ResizeThumb Width="3" Cursor="SizeWE" Margin="-4 0 0 0"
                     VerticalAlignment="Stretch" HorizontalAlignment="Left"/>
            <c:ResizeThumb Width="3" Cursor="SizeWE" Margin="0 0 -4 0"
                     VerticalAlignment="Stretch" HorizontalAlignment="Right"/>
            <c:ResizeThumb Height="3" Cursor="SizeNS" Margin="0 0 0 -4"
                     VerticalAlignment="Bottom" HorizontalAlignment="Stretch"/>
            <c:ResizeThumb Width="7" Height="7" Cursor="SizeNWSE" Margin="-6 -6 0 0"
                     VerticalAlignment="Top" HorizontalAlignment="Left"/>
            <c:ResizeThumb Width="7" Height="7" Cursor="SizeNESW" Margin="0 -6 -6 0"
                     VerticalAlignment="Top" HorizontalAlignment="Right"/>
            <c:ResizeThumb Width="7" Height="7" Cursor="SizeNESW" Margin="-6 0 0 -6"
                     VerticalAlignment="Bottom" HorizontalAlignment="Left"/>
            <c:ResizeThumb Width="7" Height="7" Cursor="SizeNWSE" Margin="0 0 -6 -6"
                     VerticalAlignment="Bottom" HorizontalAlignment="Right"/>
        </Grid>
    </ControlTemplate>

    <!-- VERTEX CONTROL -->
    <Style TargetType="{x:Type GraphSharp_Controls:VertexControl}">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type GraphSharp_Controls:VertexControl}">
                    <Border Background="Transparent">
                        <Grid DataContext="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=.}">
                            <Control x:Name="PART_ResizeDecorator" Visibility="Collapsed" Template="{StaticResource ResizeDecoratorTemplate}" />
                            <Control x:Name="PART_Appearance" Template="{TemplateBinding AppearanceTemplate}" />
                            <ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center" Content="{TemplateBinding Vertex}" />
                        </Grid>
                    </Border>
                    <ControlTemplate.Triggers>
                        <MultiDataTrigger>
                            <MultiDataTrigger.Conditions>
                                <Condition Value="True" Binding="{Binding RelativeSource={RelativeSource Self},Path=IsSelected}"/>
                            </MultiDataTrigger.Conditions>
                            <Setter TargetName="PART_ResizeDecorator" Property="Visibility" Value="Visible"/>
                        </MultiDataTrigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
        <Setter Property="GraphSharp_Controls:GraphElementBehaviour.HighlightTrigger" Value="{Binding IsMouseOver, RelativeSource={RelativeSource Self}}"/>
        <Setter Property="c:DragBehaviour.IsDragEnabled" Value="True"/>
        <Setter Property="c:DragBehaviour.X" Value="{Binding Path=(GraphSharp_Controls:GraphCanvas.X), Mode=TwoWay, RelativeSource={RelativeSource Self}}"/>
        <Setter Property="c:DragBehaviour.Y" Value="{Binding Path=(GraphSharp_Controls:GraphCanvas.Y), Mode=TwoWay, RelativeSource={RelativeSource Self}}"/>
        <Setter Property="Background" Value="{Binding Path=FillBrush, RelativeSource={RelativeSource Self}}"/>
        <Setter Property="BorderThickness" Value="5,3,5,3"/>
        <Setter Property="Padding" Value="10,5,10,5"/>
        <Setter Property="MinWidth" Value="80" />
        <Setter Property="MinHeight" Value="50" />
        <Setter Property="BorderBrush" Value="{Binding Path=StrokeBrush, RelativeSource={RelativeSource Self}}"/>
        <Style.Triggers>
            <Trigger Property="GraphSharp_Controls:GraphElementBehaviour.IsHighlighted" Value="True">
                <Setter Property="BorderBrush" Value="{Binding Source={x:Static settings:XmlStudioSettings.Instance}, Path=HighlightedVertexBorderBrush}"/>
                <Setter Property="Background" Value="{Binding Source={x:Static settings:XmlStudioSettings.Instance}, Path=HighlightedVertexBackgroundBrush}"/>
                <Setter Property="Foreground" Value="{Binding Source={x:Static settings:XmlStudioSettings.Instance}, Path=HighlightedVertexForegroundBrush}"/>
            </Trigger>
            <Trigger Property="GraphSharp_Controls:GraphElementBehaviour.IsSemiHighlighted" Value="True">
                <Setter Property="BorderBrush" Value="{Binding Source={x:Static settings:XmlStudioSettings.Instance}, Path=HighlightedVertexBorderBrush}"/>
                <Setter Property="Background" Value="{Binding Source={x:Static settings:XmlStudioSettings.Instance}, Path=HighlightedVertexBackgroundBrush}"/>
                <Setter Property="Foreground" Value="{Binding Source={x:Static settings:XmlStudioSettings.Instance}, Path=HighlightedVertexForegroundBrush}"/>
            </Trigger>
            <Trigger Property="IsSelected" Value="True">
                <Setter Property="Background" Value="{Binding Source={x:Static settings:XmlStudioSettings.Instance}, Path=SelectedVertexBackgroundBrush}" />
                <Setter Property="BorderThickness" Value="7,5,7,5" />
            </Trigger>
            <MultiTrigger>
                <MultiTrigger.Conditions>
                    <Condition Property="GraphSharp_Controls:GraphElementBehaviour.IsSemiHighlighted" Value="True"/>
                    <Condition Property="GraphSharp_Controls:GraphElementBehaviour.SemiHighlightInfo" Value="Source"/>
                </MultiTrigger.Conditions>
                <Setter Property="BorderBrush" Value="{Binding Source={x:Static settings:XmlStudioSettings.Instance}, Path=SemiHighlightedSourceVertexBorderBrush}"/>
                <Setter Property="Background" Value="{Binding Source={x:Static settings:XmlStudioSettings.Instance}, Path=SemiHighlightedSourceVertexBackgroundBrush}"/>
            </MultiTrigger>
            <MultiTrigger>
                <MultiTrigger.Conditions>
                    <Condition Property="GraphSharp_Controls:GraphElementBehaviour.IsSemiHighlighted" Value="True"/>
                    <Condition Property="GraphSharp_Controls:GraphElementBehaviour.SemiHighlightInfo" Value="Target"/>
                </MultiTrigger.Conditions>
                <Setter Property="BorderBrush" Value="{Binding Source={x:Static settings:XmlStudioSettings.Instance}, Path=SemiHighlightedTargetVertexBorderBrush}"/>
                <Setter Property="Background" Value="{Binding Source={x:Static settings:XmlStudioSettings.Instance}, Path=SemiHighlightedTargetVertexBackgroundBrush}"/>
            </MultiTrigger>
        </Style.Triggers>
    </Style>

    <!-- EDGE CONTROL -->
    <Style TargetType="{x:Type GraphSharp_Controls:EdgeControl}">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type GraphSharp_Controls:EdgeControl}">
                    <Path Stroke="{TemplateBinding Foreground}"
                          StrokeThickness="{TemplateBinding StrokeThickness}"
                          MinWidth="1"
                          MinHeight="1"
                          ToolTip="{TemplateBinding ToolTip}"
                          x:Name="edgePath">
                        <Path.Data>
                            <MultiBinding Converter="{StaticResource routeToPathConverter}">
                                <Binding RelativeSource="{RelativeSource TemplatedParent}"
                                                 Path="Source.(GraphSharp_Controls:GraphCanvas.X)" />
                                <Binding RelativeSource="{RelativeSource TemplatedParent}"
                                                 Path="Source.(GraphSharp_Controls:GraphCanvas.Y)" />
                                <Binding RelativeSource="{RelativeSource TemplatedParent}"
                                                 Path="Source.ActualWidth" />
                                <Binding RelativeSource="{RelativeSource TemplatedParent}"
                                                 Path="Source.ActualHeight" />
                                <Binding RelativeSource="{RelativeSource TemplatedParent}"
                                                 Path="Target.(GraphSharp_Controls:GraphCanvas.X)" />
                                <Binding RelativeSource="{RelativeSource TemplatedParent}"
                                                 Path="Target.(GraphSharp_Controls:GraphCanvas.Y)" />
                                <Binding RelativeSource="{RelativeSource TemplatedParent}"
                                                 Path="Target.ActualWidth" />
                                <Binding RelativeSource="{RelativeSource TemplatedParent}"
                                                 Path="Target.ActualHeight" />
                                <Binding RelativeSource="{RelativeSource TemplatedParent}"
                                                 Path="RoutePoints" />
                            </MultiBinding>
                        </Path.Data>
                    </Path>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
        <Setter Property="GraphSharp_Controls:GraphElementBehaviour.HighlightTrigger"
                Value="{Binding IsMouseOver, RelativeSource={RelativeSource Self}}" />
        <Setter Property="MinWidth"
                Value="1" />
        <Setter Property="MinHeight"
                Value="1" />
        <Setter Property="Background"
                Value="Red" />
        <Setter Property="Foreground"
                Value="Silver" />
        <Setter Property="Opacity"
                Value="0.5" />
        <Style.Triggers>
            <Trigger Property="GraphSharp_Controls:GraphElementBehaviour.IsHighlighted"
                     Value="True">
                <Setter Property="Foreground"
                        Value="{Binding Source={x:Static settings:XmlStudioSettings.Instance}, Path=HighlightedEdgeBrush}" />
            </Trigger>
            <Trigger Property="GraphSharp_Controls:GraphElementBehaviour.IsSemiHighlighted"
                     Value="True">
                <Setter Property="Foreground"
                        Value="{Binding Source={x:Static settings:XmlStudioSettings.Instance}, Path=HighlightedEdgeBrush}" />
            </Trigger>
            <MultiTrigger>
                <MultiTrigger.Conditions>
                    <Condition Property="GraphSharp_Controls:GraphElementBehaviour.IsSemiHighlighted"
                               Value="True" />
                    <Condition Property="GraphSharp_Controls:GraphElementBehaviour.SemiHighlightInfo"
                               Value="InEdge" />
                </MultiTrigger.Conditions>
                <Setter Property="Foreground"
                        Value="{Binding Source={x:Static settings:XmlStudioSettings.Instance}, Path=SemiHighlightedInEdgeBrush}" />
            </MultiTrigger>
            <MultiTrigger>
                <MultiTrigger.Conditions>
                    <Condition Property="GraphSharp_Controls:GraphElementBehaviour.IsSemiHighlighted"
                               Value="True" />
                    <Condition Property="GraphSharp_Controls:GraphElementBehaviour.SemiHighlightInfo"
                               Value="OutEdge" />
                </MultiTrigger.Conditions>
                <Setter Property="Foreground"
                        Value="{Binding Source={x:Static settings:XmlStudioSettings.Instance}, Path=SemiHighlightedOutEdgeBrush}" />
            </MultiTrigger>
        </Style.Triggers>
    </Style>

    <!-- COMPOUND VERTEX CONTROL - not used in XmlStudio -->
    <Style TargetType="{x:Type GraphSharp_Controls:CompoundVertexControl}">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type GraphSharp_Controls:CompoundVertexControl}">
                    <Border BorderBrush="{TemplateBinding BorderBrush}"
                            BorderThickness="{TemplateBinding BorderThickness}"
                            Background="{TemplateBinding Background}"
							Padding="10">
                        <GroupBox>
                            <GroupBox.Header>adfajkdsfklad</GroupBox.Header>

                            <ItemsControl x:Name="PART_InnerCanvas"
                                          ItemsSource="{TemplateBinding Vertices}">
                                <ItemsControl.ItemsPanel>
                                    <ItemsPanelTemplate>
                                        <StackPanel Orientation="Vertical" />
                                    </ItemsPanelTemplate>
                                </ItemsControl.ItemsPanel>
                            </ItemsControl>
                        </GroupBox>
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>

        <Setter Property="GraphSharp_Controls:GraphElementBehaviour.HighlightTrigger"
                Value="{Binding IsMouseOver, RelativeSource={RelativeSource Self}}" />
        <Setter Property="c:DragBehaviour.IsDragEnabled"
                Value="True" />
        <Setter Property="c:DragBehaviour.X"
                Value="{Binding (GraphSharp_Controls:GraphCanvas.X), Mode=TwoWay, RelativeSource={RelativeSource Self}}" />
        <!--GraphSharp_Controls:GraphCanvas.X-->
        <Setter Property="c:DragBehaviour.Y"
                Value="{Binding (GraphSharp_Controls:GraphCanvas.Y), Mode=TwoWay, RelativeSource={RelativeSource Self}}" />
        <Setter Property="BorderThickness"
                Value="22" />
        <Setter Property="BorderBrush"
                Value="Silver" />
        <Setter Property="Background">
            <Setter.Value>
                <LinearGradientBrush StartPoint="0,0"
                                     EndPoint="1,1">
                    <GradientStop Color="White"
                                  Offset="0" />
                    <GradientStop Color="BurlyWood"
                                  Offset="1" />
                </LinearGradientBrush>
            </Setter.Value>
        </Setter>
        <Style.Triggers>
            <Trigger Property="LayoutMode"
                     Value="Automatic">
                <Setter Property="Template">
                    <Setter.Value>
                        <ControlTemplate TargetType="{x:Type GraphSharp_Controls:CompoundVertexControl}">
                            <Border BorderBrush="{TemplateBinding BorderBrush}"
                                    BorderThickness="{TemplateBinding BorderThickness}"
                                    Background="{TemplateBinding Background}"
									Padding="10">
                                <GroupBox>
                                    <GroupBox.Header>wdawew</GroupBox.Header>

                                    <ItemsControl x:Name="PART_InnerCanvas"
                                                  ItemsSource="{TemplateBinding Vertices}">
                                        <ItemsControl.ItemsPanel>
                                            <ItemsPanelTemplate>
                                                <GraphSharp_Controls:GraphCanvas Background="White"/>
                                            </ItemsPanelTemplate>
                                        </ItemsControl.ItemsPanel>
                                    </ItemsControl>
                                </GroupBox>
                            </Border>
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
                <Setter Property="Background">
                    <Setter.Value>
                        <LinearGradientBrush StartPoint="0,0"
                                             EndPoint="1,1">
                            <GradientStop Color="White"
                                          Offset="0" />
                            <GradientStop Color="Silver"
                                          Offset="1" />
                        </LinearGradientBrush>
                    </Setter.Value>
                </Setter>
            </Trigger>
            <Trigger Property="GraphSharp_Controls:GraphElementBehaviour.IsHighlighted"
                     Value="True">
                <Setter Property="BorderBrush"
                        Value="Orange" />
                <Setter Property="BorderThickness"
                        Value="2" />
            </Trigger>
            <Trigger Property="GraphSharp_Controls:GraphElementBehaviour.IsSemiHighlighted"
                     Value="True">
                <Setter Property="BorderBrush"
                        Value="Yellow" />
                <Setter Property="BorderThickness"
                        Value="2" />
            </Trigger>
            <MultiTrigger>
                <MultiTrigger.Conditions>
                    <Condition Property="GraphSharp_Controls:GraphElementBehaviour.IsSemiHighlighted"
                               Value="True" />
                    <Condition Property="GraphSharp_Controls:GraphElementBehaviour.SemiHighlightInfo"
                               Value="Source" />
                </MultiTrigger.Conditions>
                <Setter Property="BorderBrush"
                        Value="Red" />
                <Setter Property="BorderThickness"
                        Value="2" />
            </MultiTrigger>
            <MultiTrigger>
                <MultiTrigger.Conditions>
                    <Condition Property="GraphSharp_Controls:GraphElementBehaviour.IsSemiHighlighted"
                               Value="True" />
                    <Condition Property="GraphSharp_Controls:GraphElementBehaviour.SemiHighlightInfo"
                               Value="Target" />
                </MultiTrigger.Conditions>
                <Setter Property="BorderBrush"
                        Value="Blue" />
                <Setter Property="BorderThickness"
                        Value="2" />
            </MultiTrigger>
        </Style.Triggers>
    </Style>
</ResourceDictionary>